home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 23
/
Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso
/
Aminet
/
text
/
misc
/
WordConverter.lha
/
wordconverter
/
rexx
/
PSGImportWord.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1997-11-27
|
4KB
|
106 lines
/*rx
* $VER: PSGImportWord.rexx 1.0.2 (21.11.97) ©1997 Peter Drapich
* This ARexx script is for use with PageStream 3 DTP package ©SoftLogik.
*
* PSGImportWord.rexx is a part of WordConverter archive and imports texts from documents
* created with Word for Windows or Mac into PageStream document.
*
* During execution of this script, you'll be asked with the filerequester for the
* source Word document filename.
* This script uses WordConverter to convert Word documents into text.
* If WordConverter isnt in the current path, you'll be prompted to select its current
* location.
*
* WordConverter and PSGImportWord.rexx were written by Peter Drapich in 1997
* and are shareware software copyrighted by Peter Drapich.
*
* Email any remarks or new ideas to: docent@union.org.pl
*
*/
options results
/* options failat 20*/
trace off
CR = '0A'X
ERR_REVUNKNOWN=6 /* these are internal error codes, returned by WordConverter */
ERR_NOTWORDFILE=7
IF ~show('L','rexxsupport.library') THEN
call addlib('rexxsupport.library',0,-30)
IF ~show('L','softlogik:libs/slarexxsupport.library') THEN
call addlib("softlogik:libs/slarexxsupport.library", 0, -30)
address 'PAGESTREAM'
/* check and see if a text frame is selected */
getcursor type objtype
if RC>0 | objtype='TEXTOBJ' then do
call doalert('The insertion point must be in a text frame, please try again.')
exit 0
end
filename = 'WordConverter'
do while ~exists(filename)
getfile title "'Select the location of Word Converter'" LOAD POSBUTTON "OK" NEGBUTTON "Cancel"
if rc~=0 then exit 0
filename = result
end
filename = '"'||filename||'"'
getfile title "'Select the Word document to import'" LOAD POSBUTTON "Import" NEGBUTTON "Cancel"
if rc~=0 then exit 0
if (result = 'result') then do
call doalert 'No source filename was specified.'
exit 0
end
srcfilename = result
srcfilename = '"'||srcfilename||'"'
tempname = 'T:wordconv.temp'
commandrc=1
do while (commandrc)
address command filename srcfilename tempname
commandrc = rc
if commandrc=ERR_REVUNKNOWN then do
sMsgText='Unknown revision of Word document'
iMsgLength=length(sMsgText)
allocarexxrequester '"WordConverter"' iMsgLength*8+20 65
hDialog=result
addarexxgadget hDialog EXIT 12 44 70 label "OK"
hDialog.ok=result
addarexxgadget hDialog EXIT 200 44 70 label "Cancel"
hDialog.cancel=result
addarexxgadget hDialog TEXT 8 12 iMsgLength*8+8 border none string '"'sMsgText'"'
sMsgText='Do you want to read it anyway ?'
iMsgLength=length(sMsgText)
addarexxgadget hDialog TEXT 16 22 iMsgLength*8+8 border none string '"'sMsgText'"'
doarexxrequester hDialog
action=result
freearexxrequester hDialog
if action=hDialog.cancel then signal cleanup
address command filename srcfilename tempname 'FORCE'
commandrc = rc
end
if commandrc=ERR_NOTWORDFILE then do
call doalert 'This is not a Word file.'
exit 0
end
if commandrc>0 & commandrc~=ERR_REVUNKNOWN then do
call doalert 'An error has occured.'
exit 0
end
end
INSERTTEXT FILE tempname||'.txt' CHARSET windows STATUS
address command 'delete' tempname||'.txt quiet'
exit 0
doalert:
parse arg sAlertText
/* Display an alert requester */
iAlertLength=length(sAlertText)
allocarexxrequester '"WordConverter"' iAlertLength*8+24 55
hAlertReq=result
addarexxgadget hAlertReq EXIT iALertLength*8-58 38 70 label "_Exit"
hAlert.exit=result
addarexxgadget hAlertReq TEXT 8 12 iAlertLength*8+8 border none string '"'sAlertText'"'
doarexxrequester hAlertReq
freearexxrequester hAlertReq
signal cleanup
return
cleanup:
exit